/*
 Navicat Premium Data Transfer

 Source Server         : mysql
 Source Server Type    : MySQL
 Source Server Version : 50718
 Source Host           : localhost
 Source Database       : test_dw

 Target Server Type    : MySQL
 Target Server Version : 50718
 File Encoding         : utf-8

 Date: 10/15/2019 17:23:22 PM
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
--  Table structure for `dim_product_sku`
-- ----------------------------
DROP TABLE IF EXISTS `dim_product_sku`;
CREATE TABLE `dim_product_sku` (
  `oid` bigint(20) NOT NULL AUTO_INCREMENT,
  `product_code` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL COMMENT '商品代码',
  `product_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL COMMENT '商品描述',
  `brand_id` bigint(20) DEFAULT NULL COMMENT '品牌',
  `brand_name` varchar(100) DEFAULT NULL COMMENT '品牌',
  `category_id` bigint(20) DEFAULT NULL,
  `category_code` varchar(255) DEFAULT NULL COMMENT '商品分类',
  `category_name` varchar(100) DEFAULT NULL COMMENT '类目名称',
  `category_pid` bigint(20) DEFAULT NULL COMMENT '父类目ID',
  `category_pcode` varchar(255) DEFAULT NULL COMMENT '父类目编码',
  `category_pname` varchar(100) DEFAULT NULL COMMENT '父类目名称',
  `bar_code` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL COMMENT 'SKU编号',
  `sku_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL COMMENT 'SKU名称',
  `cost_price` decimal(20,6) DEFAULT NULL COMMENT '标准成本价',
  `spec_code` varchar(50) DEFAULT NULL COMMENT '规格代码',
  `spec_name` varchar(100) DEFAULT NULL COMMENT '规格名称',
  `last_update` datetime DEFAULT NULL COMMENT '最新更新时间',
  `start_date` datetime DEFAULT NULL COMMENT '生效日期',
  `end_date` datetime DEFAULT NULL COMMENT '时效日期',
  `insertdate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'dw插入日期',
  PRIMARY KEY (`oid`),
  KEY `i_dw_product_bar_code` (`bar_code`),
  KEY `i_dw_product_start_end_date` (`start_date`,`end_date`),
  KEY `i_dw_product_sku_code` (`product_code`)
) ENGINE=MyISAM AUTO_INCREMENT=3857943 DEFAULT CHARSET=utf8;

-- ----------------------------
--  Records of `dim_product_sku`
-- ----------------------------
BEGIN;
INSERT INTO `dim_product_sku` VALUES ('3857941', 'DJ0002', '雪菊', '1', '本草', '8', '0-6-7-8', '菊花', '7', '0-6-7', '菊科', 'DJ000201', '顶级80g', '100.000000', '3', '顶级80g', '2019-10-13 16:22:33', '1000-01-01 00:00:00', '9999-01-01 00:00:00', '2019-10-14 10:19:25'), ('3857940', 'DJ0001', '胎菊', '1', '本草', '8', '0-6-7-8', '菊花', '7', '0-6-7', '菊科', 'DJ000102', '杭白160g', '90.000000', '2', '杭白160g', '2019-10-13 16:22:33', '1000-01-01 00:00:00', '9999-01-01 00:00:00', '2019-10-14 10:19:25'), ('3857939', 'DJ0001', '胎菊', '1', '本草', '8', '0-6-7-8', '菊花', '7', '0-6-7', '菊科', 'DJ000101', '杭白80g', '50.000000', '1', '杭白80g', '2019-10-13 16:22:33', '1000-01-01 00:00:00', '9999-01-01 00:00:00', '2019-10-14 10:19:25'), ('3857942', 'DJ0002', '雪菊', '1', '本草', '8', '0-6-7-8', '菊花', '7', '0-6-7', '菊科', 'DJ000202', '特级160g', '80.000000', '4', '特级160g', '2019-10-13 16:22:33', '1000-01-01 00:00:00', '9999-01-01 00:00:00', '2019-10-14 10:19:25');
COMMIT;

-- ----------------------------
--  Table structure for `dw_m_sales`
-- ----------------------------
DROP TABLE IF EXISTS `dw_m_sales`;
CREATE TABLE `dw_m_sales` (
  `id` bigint(20) NOT NULL,
  `order_id` varchar(50) COLLATE utf8_bin DEFAULT NULL,
  `trade_id` varchar(50) COLLATE utf8_bin DEFAULT NULL,
  `trans_date` datetime DEFAULT NULL,
  `convert_date` datetime DEFAULT NULL COMMENT '转换日期',
  `pay_date` datetime DEFAULT NULL COMMENT '付款日期',
  `order_type` varchar(30) COLLATE utf8_bin DEFAULT NULL,
  `trade_from` varchar(50) COLLATE utf8_bin DEFAULT NULL COMMENT '来源，移动orPC',
  `product_code` varchar(50) COLLATE utf8_bin DEFAULT NULL,
  `bar_code` varchar(50) COLLATE utf8_bin DEFAULT NULL,
  `amount` decimal(10,5) DEFAULT NULL COMMENT '总金额',
  `discount_amount` decimal(10,5) DEFAULT NULL COMMENT '折扣数额',
  `amount_actual` decimal(15,5) DEFAULT NULL COMMENT '实付金额',
  `quantity` int(11) DEFAULT NULL COMMENT '数量',
  `store_id` int(11) DEFAULT NULL COMMENT '店铺内码',
  `store_code` varchar(50) COLLATE utf8_bin DEFAULT NULL,
  `store_name` varchar(100) COLLATE utf8_bin DEFAULT NULL,
  `platform_id` int(11) DEFAULT NULL COMMENT '平台内码',
  `platform_code` varchar(20) COLLATE utf8_bin DEFAULT NULL,
  `platform_name` varchar(200) COLLATE utf8_bin DEFAULT NULL,
  `buyer_nick` varchar(100) COLLATE utf8_bin DEFAULT NULL,
  `oms_order_status` varchar(50) COLLATE utf8_bin DEFAULT NULL,
  `last_update` datetime DEFAULT NULL,
  `insertdate` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `i_sales_insertdate` (`insertdate`),
  KEY `i_order_id` (`order_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

-- ----------------------------
--  Records of `dw_m_sales`
-- ----------------------------
BEGIN;
INSERT INTO `dw_m_sales` VALUES ('2', '1', '100010110111', '2019-10-08 16:50:00', '2019-10-08 16:50:09', '2019-10-08 16:50:03', '1', null, 'DJ0002', 'DJ000201', '360.00000', '20.00000', '340.00000', '2', '2', 'tb_bencaoqj', '天猫本草旗舰店', '1', 'taobao', '淘宝平台', 'test', '1', null, '2019-10-09 12:00:55'), ('1', '1', '100010110111', '2019-10-08 16:50:00', '2019-10-08 16:50:09', '2019-10-08 16:50:03', '1', null, 'DJ0001', 'DJ000101', '100.00000', '0.00000', '100.00000', '1', '2', 'tb_bencaoqj', '天猫本草旗舰店', '1', 'taobao', '淘宝平台', 'test', '1', null, '2019-10-09 12:00:55');
COMMIT;

-- ----------------------------
--  Table structure for `dw_m_sales_tmp`
-- ----------------------------
DROP TABLE IF EXISTS `dw_m_sales_tmp`;
CREATE TABLE `dw_m_sales_tmp` (
  `id` varchar(50) COLLATE utf8_bin NOT NULL,
  `insertdate` datetime DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

-- ----------------------------
--  Records of `dw_m_sales_tmp`
-- ----------------------------
BEGIN;
INSERT INTO `dw_m_sales_tmp` VALUES ('1', '2019-10-09 12:00:55');
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;
